Add OpenTelemetry trace id and span id onto the logging context - #13872
Add OpenTelemetry trace id and span id onto the logging context#13872sureshanaparti wants to merge 2 commits into
Conversation
…y span trace id and span id
…t managed opentelemetry-api version; fix removeContextParameters CME
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #13872 +/- ##
=============================================
- Coverage 17.69% 3.69% -14.01%
=============================================
Files 5925 449 -5476
Lines 533539 38176 -495363
Branches 65274 7072 -58202
=============================================
- Hits 94427 1409 -93018
+ Misses 428435 36580 -391855
+ Partials 10677 187 -10490
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18851 |
|
@sureshanaparti as discussed closing this PR, let's reopen or create a new one after rework is made |
Description
This PR introduces the ApiTraceFilter that records a per request trace id on the log context plus a mosaic addition to that, when a request runs inside an active OpenTelemetry span, it also records the span trace id and span id (mosaic_trace_id and mosaic_span_id) on the log context, so log lines can be joined to the distributed trace. The existing header or UUID traceid behaviour is unchanged.
No id is invented: when there is no valid span the keys are left unset and render empty, and all keys are removed in the finally block. The filter lives in the api module. LogContext gains the key constants and MDC write/remove support.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?